package com.sugon.controller.analyse;

import com.sugon.controller.AbstractController;
import com.sugon.modules.analyse.service.ISysAvailabilityAnalyseService;
import com.sugon.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 系统利用率统计Controller
 *
 * @author YuXD
 * @date 2020-06-04 13:52
 */
@RestController
@RequestMapping("/sys/stat")
public class SysAvailabilityStatController extends AbstractController {

    @Autowired
    private ISysAvailabilityAnalyseService sysAvaiStatService;

    /**
     * 用户利用率统计
     *
     * @param params
     * @return
     */
    @RequestMapping("/user")
    public R statUserAvailability(@RequestParam Map<String, Object> params) {
        // 获取部门下所有用户信息
        return R.ok().put("page", sysAvaiStatService.statUserAvailability(params));
    }

    /**
     * 部门利用率统计
     *
     * @param params
     * @return
     */
    @RequestMapping("/dept")
    public R statDeptAvailability(@RequestBody Map<String, Object> params) {
        // 获取工厂下所有部门信息
        return R.ok().put("result", sysAvaiStatService.statDeptAvailability(params));
    }

}
